/***
 * @company YIMAFU Co.
 * @copyright Copyright @2014, YIMAFU Co., Ltd. All right.
 * @since：JDK1.6
 * @version：1.0
 * @author lifajun
 * @see：
 ***/
package cn.com.qingz.core.utils;

import java.io.IOException;
import java.util.Date;

import org.apache.commons.lang3.time.DateFormatUtils;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

/**
 * @author lifajun
 * @version : 1.00
 * @copyright Copyright @2014, YIMAFU Co., Ltd. All right.
 * @Create Time : 2012-7-10 上午10:50:19
 * @Description : java日期对象经过Jackson库转换成JSON日期格式化自定义类
 * @History：Editor　　　version　　　Time　　　　　Operation　　　　　　　Description*
 * 
 */
public class JsonDateTimeSerializer extends JsonSerializer<Date> {

	@Override
	public void serialize(Date value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
		jgen.writeString(DateFormatUtils.format(value, "yyyy-MM-dd HH:mm:ss"));
	}
}